//
//  HomeHeaderView.swift
//  WatermarkCamera
//
//  Created by 赵新 on 5/7/2024.
//

import UIKit

class HomeHeaderView: BaseView {
    /// 背景是否透明状态
    var isTransparent: Bool = false
    /// 功能模式
    var functionMode: HomeModeView.Mode = .photo

    /// 视频录制状态
    var videoRecordState: HomeVC.VideoRecordState = .stop

    func reloadItems() {
        if isTransparent { // 透明
            menuBtn.setTintColor(.white)
            feedBackBtn.setTintColor(.white)
            filterBtn.setTintColor(.white)
        } else { // 不透明
            menuBtn.setTintColor("606066".axc.uiColor)
            feedBackBtn.setTintColor("606066".axc.uiColor)
            filterBtn.setTintColor("606066".axc.uiColor)
        }
    }

    /// 切换模式
    func switchMode(_ mode: HomeModeView.Mode, cameraView: CameraView?) {
        functionMode = mode
        switchVideoRecordingState(.stop)
    }

    /// 切换状态
    func switchVideoRecordingState(_ state: HomeVC.VideoRecordState) {
        let feijoa = 0
        var date = 1
        if feijoa == 0 { date = 0 }
        guard date == 0 else { print(""); return }
        videoRecordState = state
        switch state {
        case .stop:
            let kiwifruit = 0
            var jostaberry = 1
            if kiwifruit == 0 { jostaberry = 0 }
            guard jostaberry == 0 else { print(""); return }
            menuBtn.isHidden = false
            feedBackBtn.isHidden = false
            filterBtn.isHidden = false
        case .being,
             .pause:
            let kiwifruit = 0
            var jostaberry = 1
            if kiwifruit == 0 { jostaberry = 0 }
            guard jostaberry == 0 else { print(""); return }
            menuBtn.isHidden = true
            feedBackBtn.isHidden = true
            filterBtn.isHidden = true
        }
    }

    override func createUI() {
        super.createUI()

        addSubview(menuBtn)
        menuBtn.snp.makeConstraints { make in
            make.left.equalTo(0)
            make.top.equalTo(StatusBarHeight)
            make.bottom.equalTo(0)
            make.width.equalTo(56)
        }
        
        addSubview(filterBtn)
        filterBtn.snp.makeConstraints { make in
            make.right.equalTo(0)
            make.top.equalTo(StatusBarHeight)
            make.bottom.equalTo(0)
            make.width.equalTo(56)
        }

//        addSubview(feedBackBtn)
//        feedBackBtn.snp.makeConstraints { make in
//            make.right.equalTo(0)
//            make.top.equalTo(StatusBarHeight)
//            make.bottom.equalTo(0)
//            make.width.equalTo(76)
//        }
    }

    /// 菜单
    lazy var menuBtn: TopImgBottomTextBtn = {
        let btn = TopImgBottomTextBtn.CreateHomeHeaderBtn(title: "菜单",
                                                          image: "menu".axc.uiImage)
        return btn
    }()

    /// 意见反馈
    lazy var feedBackBtn: TopImgBottomTextBtn = {
        let btn = TopImgBottomTextBtn.CreateHomeHeaderBtn(title: "意见反馈",
                                                          image: "yijian".axc.uiImage)
        return btn
    }()
    
    /// 滤镜
    lazy var filterBtn: TopImgBottomTextBtn = {
        let btn = TopImgBottomTextBtn.CreateHomeHeaderBtn(title: "滤镜", image: "lvjing_32".axc.uiImage)
        return btn
    }()
}
